import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import 'virtual:svg-icons-register'
import gloablComponent from '@/components/index';
import "@/utils/title"
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import store from "@/store/index"
import "swiper/swiper-bundle.css"
import router from "./router/index"

import "animate.css"

import VueLazyload from 'vue-lazyload'
import errorimage from "@/assets/images/error.gif"
import loadimage from "@/assets/images/loading.gif"

import hljs from 'highlight.js';
import VMdPreview from '@kangc/v-md-editor/lib/preview';
import '@kangc/v-md-editor/lib/style/preview.css';
import VMdEditor from '@kangc/v-md-editor';
import '@kangc/v-md-editor/lib/style/base-editor.css';
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js';
import '@kangc/v-md-editor/lib/theme/style/vuepress.css';

// Prism
import Prism from 'prismjs';
// highlight code
import 'prismjs/components/prism-json';

VMdEditor.use(vuepressTheme, {
  Prism,
  Hljs:hljs,
});

VMdPreview.use(vuepressTheme, {
  Hljs: hljs,
});

const app = createApp(App);
// 把icon注册为全局组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(gloablComponent);
app.use(VMdEditor);
app.use(VueLazyload,{
  error: errorimage,
  loading: loadimage,
  attempt: 1
});
app.use(router)
app.use(store);
app.use(VMdPreview);
app.mount('#app')
